#include "ImageView.h"

ImageView::ImageView(std::string uiObjectId, Image image, const int x,
                     const int y, const double scale, const double angle)
    : UIObject(uiObjectId, x, y, 0, 0, scale, angle), image(image) {
  width = image.getWidth();
  height = image.getHeight();
}

void ImageView::init() { UIObject::init(); }

void ImageView::draw() { drawArea(Rect{x, y, width, height}); }
void ImageView::drawArea(const Rect& area) {
  image.drawArea(area, Rect{0, 0, width, height},
                 Rect{x, y, int(width * scale), int(height * scale)}, angle);
  UIObject::drawArea(area);
}